package com.imooc.bilibili.controller;

import com.imooc.bilibili.request.VideoCollectionRequest;
import com.imooc.bilibili.result.Result;
import com.imooc.bilibili.service.VideoCollectionService;
import com.imooc.bilibili.support.UserSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user-video-controller")
public class VideoColletionController {

    @Autowired
    private UserSupport userSupport;

    @Autowired
    private VideoCollectionService videoCollectionService;

    /**
     * 添加用户视频收藏分组
     * @param request
     * @return
     */
    @PostMapping("video-collection-insert")
    public Result<String> insertVideoCollection(@RequestBody VideoCollectionRequest request) {
        Long userId = userSupport.getCurrnetUserId().get("userId");
        request.setUserId(userId);
        videoCollectionService.insertCollectonGroupService(request);
        return Result.success();
    }
}
